<!DOCTYPE html>
<html>

	
	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title>后台管理系统</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="favicon.ico">
		<link href="__PUBLIC__/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">

		<link href="__PUBLIC__/Admin/css/animate.min.css" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
		<!--[if lt IE 9]>
    	<meta http-equiv="refresh" content="0;ie.html" />
    	<![endif]-->
		<script>
			if(window.top !== window.self) {
				window.top.location = window.location;
			}
		</script>
	</head>

	<body class="gray-bg">

		<div class="middle-box text-center loginscreen  animated fadeInDown">
			<div>
				<div>
					<h1 style="height:100px"></h1>
				</div>
				<h3>代理管理系统</h3>
				<form class="m-t" role="form" method="post" action="{:U('Agent/Login/login')}" id="LoginForm">
					<div class="form-group">
						<input type="text" id="username" name="username" class="form-control" placeholder="用户名" required>
					</div>
					<div class="form-group">
						<input type="password" id="password" name="password" class="form-control" placeholder="密码" required>
					</div>
					<div class="form-group">
						<input type="text" id="safeCode" name="safeCode" class="form-control" placeholder="后台进入安全码" required>
					</div>
					
					<div class="form-group">
                        <input type="text" class="form-control" aria-describedby="basic-addon3" id="code" name="code" placeholder='请输入验证码' style="width:50%;float: left;">
                        <img src="{:U('Agent/login/verify',array())}" id="verify" style="width:130px;height:32px;display:block-inline;padding:2px 0 0 5px;" title="点击刷新" alt="验证码">
                    </div>
					<button type="submit" class="btn btn-success block full-width m-b">登 录</button>
				</form>
			</div>
		</div>
		<script src="__PUBLIC__/Admin/js/jquery.min.js?v=2.1.4"></script>
		<script src="__PUBLIC__/Admin/js/bootstrap.min.js?v=3.3.6"></script>
		
		<script src="__PUBLIC__/Common/js/ajaxForm.js"></script>
		<script src="__PUBLIC__/layer/layer.js"></script>
		
		<script>
			$(function(){
				$('#LoginForm').ajaxForm({
					beforeSubmit: checkForm,
					success: complete, 
					dataType: 'json'
				});
				function checkForm(){
					if( '' == $.trim($('#username').val())){
						layer.alert('用户名不能为空', {icon: 5}, function(index){
			 			layer.close(index);
						$('#username').focus(); 
						});
						return false;
					}
					if( '' == $.trim($('#password').val())){
						layer.alert('密码不能为空', {icon: 5}, function(index){
			 			layer.close(index);
						$('#password').focus(); 
						});
						return false;
					}
				}
				function complete(data){
					if(data.status==1){
						$('.btn').attr('disabled','disabled');
						layer.msg(data.info, function(index){
			 				layer.close(index);
							window.location.href=data.url;
						});
					}else{
						layer.msg(data.info);
						// $('#password').val('').focus();
						return false;	
					}
				}
				
				// 验证码生成 
                var captcha_img = $('#verify');  
                var verifyimg = captcha_img.attr("src");  
                captcha_img.attr('title', '点击刷新');  
                captcha_img.click(function(){  
                    if( verifyimg.indexOf('?')>0){  
                        $(this).attr("src", verifyimg+'&random='+Math.random());  
                    }else{  
                        $(this).attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());  
                    }  
                });
			});
		</script>
	</body>
</html>